<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html; charset=utf-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>提现记录</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
</head>
<body>
  <div class="layui-fluid">
    <div class="layui-card">
      <div class="layui-form layui-card-header layuiadmin-card-header-auto">
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">时间</label>
            <div class="layui-input-inline">
              <input name="timestr" id="laydate-cn"  autocomplete="off" class="layui-input">
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">流水号</label>
            <div class="layui-input-inline">
              <input type="text" name="payCode" placeholder="请输入" autocomplete="off" class="layui-input">
            </div>
          </div> 
          <div class="layui-inline">
            <label class="layui-form-label">支出|收入</label>
            <div class="layui-input-inline">
	            <select name="status" class="select">
	                <option value="">请选择</option>
	                <option value="1">审核中</option>
	                <option value="2">通过</option>
	                <option value="3">驳回</option>
	            </select>
			</div>
          </div>                              
          <div class="layui-inline">
            <button class="layui-btn layuiadmin-btn-list" lay-submit lay-filter="LAY-app-contlist-search">
              <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
            </button>
          </div>
        </div>
      </div>
      
      <div class="layui-card-body">
        <div style="padding-bottom: 10px;">
          <button class="layui-btn layuiadmin-btn-list" data-type="add">提现</button>
        </div>      
        <table class="layui-table" lay-filter="table" id="table">
	        <script type="text/html" id="status">
              {{#  if(d.status == 1){ }}
              <span style="color:#01AAED">审核中</span>
              {{#  } else if(d.status == 2){ }}
              <span style="color:#5FB878">通过</span>
              {{#  } else{ }}
              <span style="color:#FF5722">驳回</span>
              {{#  } }}
        	</script>
        <script type="text/html" id="table-operate">
          <a class="layui-btn layui-btn-xs" lay-event="detail">查看</a>
        </script>
      </div>
    </div>
  </div>

<script type="text/javascript" src="/layuiadmin/layui/layui.js"></script>
<script type="text/javascript" src="/js/sx/login/jquery3.4.js"></script>
<script>
    layui.config({
        base: '/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','form','laydate', 'table'], function(){
        var $ = layui.$,form = layui.form,laydate=layui.laydate, table = layui.table;
        form.render('select');
        laydate.render({
            elem: '#laydate-cn',
            range:'~'
        });

        table.render({
            elem: '#table',
            url: '/cash/queryCashList',
            page: true,
            request: {
                pageName: 'current',
                limitName: 'size'
            },
            cols: [[
                {field: 'id', title: '编号', minWidth: 60,fixed:'center'},
                {field: 'payCode', title: '流水号', minWidth: 180},
                {field: 'cashMoney', title: '提现金额', minWidth:90},
                {field: 'realMoney', title: '到账金额', minWidth:90},
                {field: 'realName', title: '真实名称', minWidth: 90},
                {field: 'bankName', title: '银行名称', minWidth: 120},
                {field: 'bankCode', title: '银行卡号', minWidth: 180},
                {field: 'phone', title: '绑定手机', minWidth: 120},
                {field: 'status', title: '状态', minWidth: 60, templet: "#status"},
                {field: 'remark', title: '驳回原因', minWidth: 120},
                {
                    field: 'createTime',
                    title: '申请时间',
                    minWidth: 160,
                    templet: "<div>{{ d.createTime ==null || '' ? '-':layui.util.toDateString(d.createTime ,'yyyy-MM-dd HH:mm:ss')}}</div>"
                },
                {
                    field: 'endTime',
                    title: '审核完成时间',
                    minWidth: 160,
                    templet:"<div>{{ d.endTime ==null || '' ? '-':layui.util.toDateString(d.endTime ,'yyyy-MM-dd HH:mm:ss')}}</div>"
                }

            ]]
        });
        form.on('submit(LAY-app-contlist-search)', function(data){
            var field = data.field;
            //执行重载
            table.reload('table', {
                where: field
            });
        });

        layui.use('laydate', function(){
            var laydate = layui.laydate;

            //日期范围
            laydate.render({
                elem: '#laydate-cn'
                ,range: true
            });

        });

        var active = {
            add: function(){
                layer.open({
                  type: 2
                  ,title: '提现申请'
                  ,content: '/cash/cashApply'
                  ,maxmin: true
                  ,area: ['550px', '350px']
                  ,btn: ['确定', '取消']
                  ,yes: function(index, layero){
                    //点击确认触发 iframe 内容中的按钮提交
                    var submit = layero.find('iframe').contents().find("#layuiadmin-app-form-submit");
                    submit.click();
                  }
                }); 
              }
        };
        
        $('.layui-btn.layuiadmin-btn-list').on('click', function(){
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
          });
    });

</script>
</body>
</html>
